package com.it135.citytraffic.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.it135.citytraffic.pojo.entity.Survey;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SurveyMapper extends BaseMapper<Survey> {
    //批量保存
    @Insert("insert into survey (name, question, answer, create_time) " +
            "value (#{name}, #{question}, #{answer}, #{createTime})")
    void save(Survey survey);
    //查询问题
    @Select("select question from survey group by question")
    List<String> getQuestionName();
    //查询答案
    @Select("select answer from survey where question = #{question}")
    List<String> getAnswer(String question);
}
